<!--销售主体（公司）信息配置页面-->
<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-sys__good">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item v-if="$hasPermission('sys:getModelOneConfig:info')" >
          <el-button type="primary" @click="settingCk()">分润配置</el-button>
        </el-form-item>
        <el-form-item v-if="$hasPermission('sys:getDiscountConfig:info')">
          <el-button type="warning" @click="DiscountConfigCk()">折扣配置</el-button>
        </el-form-item>
        <el-form-item v-if="$hasPermission('sys:getWanQiuModel:info')">
          <el-button type="info" @click="SaveWanQiuConfigCk()">万秋配置</el-button>
        </el-form-item>
        <el-form-item>
          <el-button  v-if="$hasPermission('api:shopInfo:page')" @click="getDataList()">刷新</el-button>
        </el-form-item>
      </el-form>
      <el-table
          v-loading="dataListLoading"
          :data="dataList"
          stripe highlight-current-row
          @selection-change="dataListSelectionChangeHandle"
          @sort-change="dataListSortChangeHandle"
          style="width: 100%;">
        <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
        <el-table-column prop="logo" label="公司logo" header-align="center" align="center" width="">
          <template slot-scope="{row}">
            <!-- 图片展示 -->
            <el-popover trigger="click" placement="top" popper-class="popper">
              <img v-if="row.logo" :src="row.logo">
              <el-image v-if="row.logo" slot="reference" :src="row.logo">
                <div slot="error">
                  暂无图片
                </div>
              </el-image>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column prop="fans" label="联系二维码" header-align="center" align="center" width="">
          <template slot-scope="{row}">
            <!-- 图片展示 -->
            <el-popover trigger="click" placement="top" popper-class="popper">
              <img v-if="row.fans" :src="row.fans">
              <el-image v-if="row.fans" slot="reference" :src="row.fans">
                <div slot="error">
                  暂无图片
                </div>
              </el-image>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column prop="poster" label="海报背景图" header-align="center" align="center" width="">
          <template slot-scope="{row}">
            <!-- 图片展示 -->
            <el-popover trigger="click" placement="top" popper-class="popper">
              <img v-if="row.poster" :src="row.poster">
              <el-image v-if="row.poster" slot="reference" :src="row.poster">
                <div slot="error">
                  暂无图片
                </div>
              </el-image>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column prop="coverUrl" label="链接分享图" header-align="center" align="center" width="">
          <template slot-scope="{row}">
            <!-- 图片展示 -->
            <el-popover trigger="click" placement="top" popper-class="popper">
              <img v-if="row.coverUrl" :src="row.coverUrl">
              <el-image v-if="row.coverUrl" slot="reference" :src="row.coverUrl">
                <div slot="error">
                  暂无图片
                </div>
              </el-image>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column prop="personalCard" label="个人名片" header-align="center" align="center" width="">
          <template slot-scope="{row}">
            <!-- 图片展示 -->
            <el-popover trigger="click" placement="top" popper-class="popper">
              <img v-if="row.personalCard" :src="row.personalCard">
              <el-image v-if="row.personalCard" slot="reference" :src="row.personalCard">
                <div slot="error">
                  暂无图片
                </div>
              </el-image>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column prop="title" label="公司名称" header-align="center" align="center" width="" show-overflow-tooltip></el-table-column>
        <el-table-column prop="sendPhone" label="寄件人电话" header-align="center" align="center" width="" show-overflow-tooltip></el-table-column>
        <el-table-column prop="copyright" label="版权描述" header-align="center" align="center" width=""  show-overflow-tooltip></el-table-column>
        <el-table-column prop="apiDomain" label="api域名" header-align="center" align="center" width="" show-overflow-tooltip></el-table-column>
        <el-table-column prop="staticDomain" label="静态资源域名" header-align="center" align="center" width="" show-overflow-tooltip></el-table-column>
        <el-table-column prop="payNotify" label="支付回调" header-align="center" align="center" width="" show-overflow-tooltip></el-table-column>
        <el-table-column prop="refundNotify" label="退款通知" header-align="center" align="center" width="" show-overflow-tooltip></el-table-column>
        <el-table-column prop="createDate" label="创建日期" header-align="center" align="center"></el-table-column>
        <el-table-column label="操作" fixed="right" header-align="center" align="center" width="150">
          <template slot-scope="scope">
            <el-link v-if="$hasPermission('api:shopInfo:update')" type="primary"
                       @click="addOrUpdateHandle(scope.row.id)">修改
            </el-link>
          </template>
        </el-table-column>
      </el-table>
      <!-- 弹窗, 新增 / 修改 -->
      <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
      <!-- 2+1配置, 新增 / 修改 -->
      <config-parameter-setting v-if="showConfigParameterSetting"  ref="configParameterSetting"></config-parameter-setting>
      <!-- 折扣比例配置, 新增 / 修改 -->
      <save-discount-config v-if="showSaveDiscountConfig"  ref="saveDiscountConfig"></save-discount-config>
      <!-- 万秋配置, 新增 / 修改 -->
      <save-wan-qiu-config v-if="showSaveWanQiuConfig"  ref="saveWanQiuConfig"></save-wan-qiu-config>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './companyInfoAddOrUpdate.vue'
import configParameterSetting from './configParameterSettingAddOrUpdate.vue'
import saveDiscountConfig from './saveDiscountConfigAddOrUpdate.vue'
import saveWanQiuConfig from './saveWanQiuConfigAddOrUpdate.vue'

export default {
  mixins: [mixinViewModule],
  data() {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/api/shopInfo/page',
        getDataListIsPage: true,
        deleteURL: '/api/shopInfo',
        deleteIsBatch: true
      },
      dataForm: {
        id: '',
        title: '',	              //公司名称
        copyright: '',            //版权描述
        apiDomain: '',            //api域名
        staticDomain: '',	        //静态资源域名
        payNotify: '',	          //支付回调
        fans: '',                 //联系二维码
        poster: '',	              //海报背景图
        logo: '',	                //公司logo
        refundNotify: '',	        //退款通知
        sendPhone:'',             //寄件人电话
        coverUrl:'',              //小程序分享链接图
        personalCard:'',          //个人名片
      },
      showConfigParameterSetting: false,    //是否显示2+1配置
      showSaveDiscountConfig:false,         //是否显示折扣配置
      showSaveWanQiuConfig:false,           //是否显示万秋配置
      settingForm:{                         //2+1参数配置
        id: '',                             //id
        provincesRate: '',                  //省公司分成比例
        citiesRate:'',                      //市公司分成比例
        countiesRate:'',                    //区公司分成比例
        bossDirectEdouNum: '',              //老板直推关系业绩数量;直推奖（升级后）
        staffDirectEdouNum:'',              //员工直推关系业绩数量;直推奖（升级前）
        indirectEdouNum:'',                 //间接关系业绩数量;	见点奖
        equalEdouNum:'',                    //平级关系业绩数量;	平级奖
        helpEdouNum: '',                    //帮扶业绩数量;	帮扶比例
        totalAmount:'',                     //订单金额
        updateCondition:'',                 //升级条件
        cashoutCondition:'',                //提现条件
      }
    }
  },
  components: {
    AddOrUpdate,
    configParameterSetting,
    saveDiscountConfig,
    saveWanQiuConfig
  },
  created() {
  },
  mounted() {},
  methods:{
    // 2+1配置新增 / 修改
    settingCk (id) {
      this.showConfigParameterSetting = true
      this.$nextTick(() => {
        this.$refs.configParameterSetting.init()
      })
    },
    // 折扣配置新增 / 修改
    DiscountConfigCk (id) {
      this.showSaveDiscountConfig = true
      this.$nextTick(() => {
        this.$refs.saveDiscountConfig.init()
      })
    },
    // 万秋配置新增 / 修改
    SaveWanQiuConfigCk () {
      this.showSaveWanQiuConfig = true
      this.$nextTick(() => {
        this.$refs.saveWanQiuConfig.init()
      })
    },
  }
}
</script>
<style lang="scss" scoped>
::v-deep .el-image__inner {
  //height: 50px;
}
img {
  height: 400px;
}
</style>
